/**
Handles what appears at the login bar when a user is logged in. This generates
the appropriate logout link (that is, the previous page plus the PHP GET variable
login_catch set to 1).
*/

var logoutcode = window.location.href.split("?")[0] + "?login_catch=1"

var LOGIN_BOX = ["<div class='login_box'>",
				 "You are logged-in as ",
				 ". [<a href='" + logoutcode + "' class='onBlack'>Logout</a>]",
				 "</div>"]

var INSERT_POINT = 2

function displayLoggedInBox(username){
	var i = 0
	var limit = LOGIN_BOX.length
	
	while(i < limit){
		if(i == INSERT_POINT){
			document.write(username)
		}
		
		document.write(LOGIN_BOX[i])
		
		i++
	}
}